import 'package:get/get.dart';
import 'package:xinxuan/http/http_util_service.dart';
import 'package:xinxuan/vo/order_detail_vo.dart';

class StoreOrderDetailPageController extends GetxController {

  /// 订单详情数据
  var orderDetailData = OrderDetailData(id: 0, status: 0).obs;

  @override
  void onReady() {
    Map<String, dynamic> argumentsMap = Get.arguments;
    int orderId = argumentsMap['orderId'];
    getStoreOrderDetail(orderId);
    super.onReady();
  }

  /// 获取订单详情
  getStoreOrderDetail(int orderId, { bool loading = true }) async {
    OrderDetailVo orderDetailVo = await HttpUtilService.getStoreOrderDetail(orderId: orderId, loading: loading);
    orderDetailData.value = orderDetailVo.data!;
    update();
  }

}